import { Token } from '@/types/data'
import { LoginAction } from '@/types/store'
import { getToken } from '@/utils/storage'

// 初始值
const initState: Token = getToken()
console.log(initState)
export default function login (state = initState, action: LoginAction) {
  console.log(action)
  if (action.type === 'login/token') {
    return action.payload
  } else if (action.type === 'login/removetoken') {
    return {}
  }
  return state
}
